/*
 * @Description: 
 * @Author: 于海龙
 * @Date: 2024-09-18 17:55:14
 * @LastEditors: 于海龙
 * @LastEditTime: 2024-09-19 08:36:15
 */
public class Duration {
    private int hours;
    private int minutes;
    private int seconds;
    // 三参构造器
    public Duration(int hours, int minutes, int seconds) {
        this.hours = hours;
        this.minutes = minutes;
        this.seconds = seconds;
    }
    // 一参构造器，参数为总的seconds
    public Duration(int totalSeconds) {
        this.hours = totalSeconds / 3600;
        this.minutes = (totalSeconds % 3600) / 60;
        this.seconds = totalSeconds % 60;
}
    // get方法
    public int getHours() {
        return hours;
    }
    public int getMinutes() {
        return minutes;
    }
    public int getSeconds() {
        return seconds;
    }
    // 返回总的秒数值
    public int getTotalSeconds() {
        return hours * 3600 + minutes * 60 + seconds;
    }
    // toString方法
    @Override
    public String toString() {
        return hours + ":" + minutes + ":" + seconds;
    }
}